#include <stdio.h>
#include <stdlib.h>
#include <time.h>

//RAND_MAX 2147483647  64 Bit: 7FFFFFFF  32 Bit: 7FFF

// 产生 10 个不同随机数。
int main(int argc, char *argv[])
{
    srand(time(NULL));
//    for(int i = 0;i < 10; i++)
//    {
//    printf("%d\n",rand()%100);

//    }

    int randArr[10];
    int count = 0;
    while (1)
    {
        int num = rand()%100;
        randArr[count++] = num;
        for(int i = 0; i < count-2; i++)
        {
//            if(count == 1)
//                break;
            if(randArr[count-1] == randArr[i])
            {
                count--;
                break;
            }
        }
        if(count == 10)
            break;
    }

    for(int i = 0;i < 10; i++)
    {
    printf("%d\n",randArr[i]);

    }
    return 0;
}


// 1970-1-1-0-0-0 经历的秒数
int main2()
{
    unsigned int seconds = time(NULL);
    printf("%u\n",seconds);
    return 0;
}


int main1()
{
//    srand(3);
    // 给随机数发生器一个种子， rand 去发生器去取数。
    srand(time(NULL));
    int randNum = rand();
    printf("%d\n",randNum);
    randNum = rand();
    printf("%d\n",randNum);
    randNum = rand();
    printf("%d\n",randNum);
    randNum = rand();
    printf("%d\n",randNum);
    randNum = rand();
    printf("%d\n",randNum);
    randNum = rand();
    printf("%d\n",randNum);
    randNum = rand();
    printf("%d\n",randNum);
    return 0;
}
